for i in range(1, 10):
    print(i)
    for x in range(4):
        if x == 2:
            break
        print(x)
